{extend name="common/main"}

{block name="css"}
<!-- 本页面需要额外添加的css请在此处添加 -->
<link href="__ADMIN__/common/css/login.css" rel="stylesheet">
{/block}

{block name="body"}
<!-- 本页面需要额外添加的html body请在此处添加 -->
<body class="login-main">
    <div class="login-title"><h1>讯腾电力报表工具</h1></div>
    <div class="login-box">
        <div class="login-box-left">
            <div class="login-box-left-info">
                <div class="login-box-left-info-title">遇到问题？</div>
                <div class="info-title-en">Encounter problems</div>
                <!--<p>拨打客服电话</p>-->
                <!--<p>扫描二维码联系在线客服</p>-->
                <!--<button class="info-contact">联系客服</button>-->
            </div>
            <div class="service-card">
                <!--<div class="card-bg">-->
                    <!--<div class="service-title">客服 Customer service</div>-->
                    <!--<div class="service-main clearfix">-->
                        <!--<div class="service-tel">联系电话：<br/>0575-84125555</div>-->
                        <!--<div class="service-qr">-->
                            <!--<img src="__ADMIN__/public/img/qr_service.jpg" alt="">-->
                            <!--<div>扫一扫二维码<br>联系客服</div>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
            </div>
        </div>
        <div class="login-box-right">
            <div class="login-box-right-info">
                <div class="login-box-left-info-title">我们的优势</div>
                <div class="info-title-en">Our advantage</div>
                <p>&nbsp;</p>
                <p>&nbsp;</p>

                <button class="info-nowlogin">立即登录</button>
            </div>
            <form>
                <div class="login-card">
                    <div class="card-bg">
                        <div class="login-title">登录 <small>Sign in</small></div>
                        <div class="login-group-input">
                            <label class="login-label" for="account"></label>
                            <input id="account" type="text" name="name" class="login-input ipt-clear" placeholder="请输入帐号" >
                        </div>
                        <div class="login-group-input">
                            <label class="login-label" for="pwd"></label>
                            <input id="pwd" type="password" name="pwd" class="login-input ipt-see" placeholder="请输入密码" >
                        </div>
                        <div class="login-group-input">
                            <label class="login-label" for="yzm"></label>
                            <input id="yzm" type="text" name="yzm" class="login-input ipt-see" placeholder="请输入验证码" autocomplete="off">
                            <img class="img-yzm" style="cursor: pointer;" src="{:captcha_src('admin_login')}" alt="验证码" onclick="this.src=this.src">
                        </div>
                        <span class="replace-yzm"><a>看不清？换一张</a></span>
                        <button type="button" class="login-submit">登&nbsp;&nbsp;录</button>
                        <div class="login-tip" style="position: absolute; top: .55rem; right: 0.85rem;font-size: .14rem;color: #CD2626; display:none;"></div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
{/block}

{block name="js"}
<!-- 本页面需要额外添加的js请在此处添加 -->
<script src="__ADMIN__/common/js/login.js"></script>
<script>
    if (window.top !== window.self) {
        window.top.location = window.location;
    }

    // 登录按钮
    $(".login-submit").bind("click", function () {
        var index = layer.load(1, {shade: [0.5]});

        var param = new Object();
        param['name'] = $(".login-card .card-bg input[name='name']").val();
        param['pwd']  = $(".login-card .card-bg input[name='pwd']").val();
        param['yzm']  = $(".login-card .card-bg input[name='yzm']").val();

        $.post("{:url('login/login_in')}", param, function (res) {
            layer.close(index);

            if (res.code != 200) {
                // 刷新验证码
                $(".img-yzm").attr("src", $(".img-yzm").attr("src") + '?r=' + Math.random());
                $("#yzm[name='yzm']").val("");

                // 显示提示信息
                $(".login-card .card-bg .login-tip").html("*" + res.msg);
                $(".login-card .card-bg .login-tip").show();
                return false;
            }
            // location.href = location.protocol + "//" + location.hostname + ":8080{:url('index/index')}";
            location.href = "{:url('index/index')}";

        })
    });

    // 刷新验证码
    $(".card-bg .replace-yzm").bind("click", function () {
        // 刷新验证码
        $(".img-yzm").attr("src", $(".img-yzm").attr("src") + '?r=' + Math.random());
        $("#yzm[name='yzm']").val("");
    });

    // 回车登录
    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            $(".login-submit").click();
        }
    });
</script>
{/block}